<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input{
            outline: none;
        }
    </style>
</head>

<body>
    <input type="text" name="" id="">

    <script>
        let ipt = document.querySelector("input")
        // onblur  输入框失去焦点时触发
        // onfocus 输入框获取焦点时触发
        // oninput  输入时触发
        // onchange  输入框内容发生改变 并且失去焦点时的
        ipt.oninput = function () {
            console.log("正在输入");
        }
        ipt.onchange = function () {
            console.log("正在修改");
        }
        // ipt.onblur = function () {
        //     console.log("失去焦点");
        // }
        // ipt.onfocus = function () {
        //     console.log("获取焦点");
        // }
    </script>
</body>

</html>